Element¶
Element represents an individual block. It can hold a widget and handle operations with it.
While setting and removing, a child_dict named dictionary is taken and returned.
The format of child_dict is as follows
child_dict = {
"child": Gtk.Widget,
"child_name": str,
"icon": Gtk.Image,
"header_child": Gtk.Widget or None,
"provider": Aduct.Provider
}
Here only header_child key is optional.
-
class
Aduct.Element.Element(child_dict=None, use_action_button=True, pack_type=0, **kwargs)¶ Makes an element based on given properties. Its CSS name is aduct-element.
Parameters: - child_dict (
dict) – A dictionary object containing properties of child. Given a valid dictionary, the child is added toselfwhile initializing. It isNone, when not given. - use_action_button (
bool) – States whether to use an action button. Default isTrue. - pack_type (
Gtk.PackType) – Specfies the position of action button. It can be an integer of value either 0 or 1, which representsGtk.PackType.STARTorGtk.PackType.ENDrespectively. The default value isGtk.PackType.START. - **kwargs – The values to be passed to
Gtk.Grid, from whichElementis derived.
Action button that is used to handle interactions with user. Its default name is aduct-element-action_button.
Type: Gtk.Button
-
pack_type¶ The position of action button in
self.Type: Gtk.PackType
-
Signals¶ - action-clicked
- Emitted with an integer when action button of
selfis clicked. The integer is 1, 2, 3 for LMB, MMB, RMB respectively. - child-added
- Emitted when a child is added to
self. - child-cleared
- Emitted when the child of
selfis cleared. - child-removed
- Emitted when the child of
selfis removed.
Note
Incase having
use_action_buttonasFalse, an action button is still created, but is not attached to theself.-
clear_child()¶ Clears the child at
self. After clearing,child-clearedsignal is emitted.
Removes the action button of
self. Nothing is done if it is already disabled.
Adds the action button of
self. Nothing is done if it is already enabled.
-
get_child()¶ Gets the child held by
self.Returns: The child of selforNoneifselfhas no child.Return type: Gtk.WidgetorNone
-
get_child_name()¶ Gets the name of child held by
self.Returns: The child name of selforNoneifselfhas no child.Return type: strorNone
-
get_header_child()¶ Gets the child packed at the header of
self.Returns: The header child of selforNoneifselfhas no header child.Return type: Gtk.WidgetorNone
-
get_icon()¶ Gets the icon representing child held by
self.Returns: The icon of action_buttonorNoneifselfhas no icon for child.Return type: Gtk.ImageorNone
-
get_props()¶ Gets the properties of child held by
self.Returns: The dictionary that can be later used to build the same interface. Return type: dict
-
get_provider()¶ Gets the provider for child held by
self.Returns: The provider of selforNoneifselfhas no child.Return type: ProviderorNone
-
remove_child()¶ Removes the child held by
self.By removing a child, all its associated properties like icon, header child are also removed. A
child-removedsignal is emitted byselfafter removal.Raises: ValueError– Raised whenselfhas no child.Returns: A dictionary with child properties. Return type: dict
-
set_child(child_dict)¶ Sets the child in
selffrom given properties.If
selfalready has a child, then its cleared before adding this new child. Achild-addedsignal is emitted after addition.Parameters: child_dict ( dict) – A valid dictionary with properties of child.
-
set_child_name(child_name)¶ Sets the name of child held by
self.Parameters: child_name ( str) – The new name of child.
-
set_from_props(props)¶ Sets the interface of
selffrom given properties.If
selfalready has a child, then its cleared before adding this new child.Parameters: props ( dict) – The dictionary from which properties are set.
-
set_header_child(header_child)¶ Sets the header child of
self.Parameters: header_child ( Gtk.Widget) – The new header child ofself.
-
set_icon(icon)¶ Sets the icon of child held by
self.Parameters: icon ( Gtk.Image) – The new icon of child.
-
set_provider(provider)¶ Sets the provider of child held by
self.Parameters: provider ( Provider) – The new provider of child.
-
type¶ Used by autodoc_mock_imports.
- child_dict (